// 
// Copyright 2010 Classpath Pty Ltd <opensource@classpath.com.au>
// 
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// 
//     http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// 

**
** A `Migration` represents a single unit of change for a database.
** Classes implementing a `Migration` may contain zero or more changes to the database, and should support changes for both upgrading and downgrading.
** 
**
abstract class Migration :  HasModifications, CanCreateTable, CanAlterTable, CanDropTable, CanExecuteSql {

    **
    ** Stores the list of [Modifications]`Modification` for this `Migration`.
    **
    override Modification[] modifications := [,]

    **
    ** The `sys::Version` of the database that this `Migration` migrates from.
    **
    abstract Version from

    **
    ** The `sys::Version` of the database that this `Migration` migrates to.
    **
    abstract Version to

    **
    ** Provides the steps to upgrade the database to the new version.
    **
    abstract Void up()

    **
    ** Provides the steps to downgrade the database to the old version.
    **
    abstract Void down()

    **
    ** Resets the `Migration` by clearing `Migration.modifications`.
    **
    Void reset() {
        modifications.clear
    }

}
